home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
lantools
/
blueprnt
/
fileserv.mod
< prev
next >
Wrap
Text File
|
1989-09-27
|
5KB
|
171 lines
;************************************************************
;* Network Hub File Server Module (FILESERV.MOD) *
;* by Craig Chaiken *
;* August 25, 1989 *
;* *
;* Function : Processes Hub Sector Read/Write Requests. *
;* Requirements: None *
;************************************************************
;
;*** Variables ***
;
startsect dw ?
function db ?
drive db ?
drive_table db maxsockets*32 dup (-1) ;all drives need updating
seclen_table dw 26 dup (512) ;sector length of drives A-Z
fileser proc near ;*** Read from or Write to Hub Sector ***
mov al,packet_buffer
cmp al,'R'
jnz files1
jmp reasec
files1: cmp al,'W'
jnz files2
jmp wrisec
files2: cmp al,'M'
jnz files3
jmp ckmedia
files3: ret
fileser endp
reasec proc near ;*** Read from Sector on Hub's Drive
call charout
mov packet_buffer,'D' ;descriptor for data packet
mov al,packet_buffer[1]
mov drive,al ;get drive
mov cl,packet_buffer[2] ;get LSB absolute sector
mov ch,packet_buffer[3] ;get MSB absolute sector
mov startsect,cx
or cx,0
jnz rloop1
mov ah,36h
mov dl,drive
inc dl
int 21h
push bx
xor bh,bh
mov bl,drive
add bx,bx
mov seclen_table[bx],cx
pop bx
rloop1: mov function,0 ;function = read sector
call sector_io
push bx
push cx
xor bh,bh
mov bl,drive
add bx,bx
mov cx,seclen_table[bx]
add cx,4
mov word ptr packet_length,cx
pop cx
pop bx
put_packet socket_num,packet_length,offset packet_buffer
ret
reasec endp
wrisec proc near ;*** Write to Sector on Hub's Drive ***
call change_flag
wrise0: call charout
mov packet_buffer,'D'
mov al,packet_buffer[1]
mov drive,al ;get drive
mov cl,packet_buffer[2] ;get LSB absolute sector
mov ch,packet_buffer[3] ;get MSB absolute sector
mov startsect,cx
wrise1: mov function,1
lea bx,packet_buffer[4]
call sector_io
get_packet socket_num,packet_length,offset packet_buffer
mov al,packet_buffer
cmp al,'T'
jnz wrise0
ret
wrisec endp
sector_io proc near ;*** Process One Sector on Hub's Drive ***
pushall
mov ax,cs
mov es,ax
mov ds,ax
mov al,' '
call charout
mov al,drive
add al,'A'
call charout
mov ax,startsect
call decout
mov al,13
call charout
mov al,drive
mov cx,1 ;manipulate 1 sector
mov dx,startsect ;get starting sector
lea bx,packet_buffer[4]
mov ah,function
or ah,ah
jz rsect
int 26h
jnc secto2
jmp secto1
rsect: int 25h
jnc secto2
secto1: mov packet_buffer,'E'
mov word ptr packet_buffer[2],ax
secto2: popf
popall
ret
sector_io endp
get_drive proc near ;SI=offset of drive modification flag
push ax
push bx
push cx
mov cl,5
xor bh,bh
shl bx,cl
xor ah,ah
add bx,ax
lea si,drive_table
add si,bx
pop cx
pop bx
pop ax
ret
get_drive endp
change_flag proc near ;mark drive as modified for all sockets
push ax
push cx
push si
mov cx,maxsockets
lea si,drive_table
xor ah,ah
mov al,drive
add si,ax
chang1: mov byte ptr [si],-1 ;mark drive as modified
add si,32 ;next socket
loop chang1
pop si
pop cx
pop ax
ret
change_flag endp
ckmedia proc near
call charout
push si
call get_drive
mov al,[si]
mov byte ptr [si],1
pop si
mov packet_buffer[2],al
mov word ptr packet_length,4
put_packet socket_num,packet_length,offset packet_buffer
ret
ckmedia endp
;************************************************************
;* End of Network File Server Module *
;************************************************************